<template>
  <div>
    <h1>app</h1>
    <button @click="getStu_info">get不加参数</button>
    <button @click="getEntry_exam">get有参数 params</button>
    <button @click="getStu_item">get有参数 query</button>
    <hr />
    学号：<input type="text" v-model="stu_id" /><br />
    姓名：<input type="text" v-model="stu_name" /><br />
    语文：<input type="text" v-model="chinese" /><br />
    数学：<input type="text" v-model="math" /><br />
    英语：<input type="text" v-model="english" /><br />
    理综：<input type="text" v-model="lizong" /><br />
    文综：<input type="text" v-model="wenzong" /><br />
    <button @click="submit">提交数据post请求</button>
    <hr />
    <button @click="postNoArgument">post请求不传参</button>
  </div>
</template>

<script>
import request from "./api/request";
export default {
  data() {
    return {
      stu_id: "",
      stu_name: "",
      chinese: 0,
      math: 0,
      english: 0,
      lizong: 0,
      wenzong: 0,
    };
  },
  mounted() {},
  methods: {
    async getStu_info() {
      // method,url,params,headerType
      let result = await request("get", "/search_info_not", {}, "");
      console.log(result);
    },
    async getEntry_exam() {
      let result = await request("get", "/search_entry/01", {}, "");
      console.log(result);
    },
    async getStu_item() {
      let result = await request(
        "get",
        "/search_info_item",
        { stu_id: "06" },
        ""
      );
      console.log(result);
    },
    async submit() {
      let params = {
        stu_id: this.stu_id,
        stu_name: this.stu_name,
        chinese: this.chinese,
        math: this.math,
        english: this.english,
        lizong: this.lizong,
        wenzong: this.wenzong,
      };
      let result = await request("post", "/entry_exam", params, "form");
      console.log(result);
    },
    async postNoArgument() {
      let result = await request("post", "/studyAxiosPost", {}, "");
      console.log(result);
    },
  },
};
</script>

<style lang="scss" scoped>
</style>